//
// UInstanceGroup.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CRGBA;
import org.ryzom.nel.misc.CVector;

public class UInstanceGroup {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public UInstanceGroup(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(UInstanceGroup obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_UInstanceGroup(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setTransformNameCallback(ITransformName pTN) {
    nel3dJNI.UInstanceGroup_setTransformNameCallback(swigCPtr, this, ITransformName.getCPtr(pTN), pTN);
  }

  public void setAddRemoveInstanceCallback(IAddRemoveInstance callback) {
    nel3dJNI.UInstanceGroup_setAddRemoveInstanceCallback(swigCPtr, this, IAddRemoveInstance.getCPtr(callback), callback);
  }

  public void setIGAddBeginCallback(IIGAddBegin callback) {
    nel3dJNI.UInstanceGroup_setIGAddBeginCallback(swigCPtr, this, IIGAddBegin.getCPtr(callback), callback);
  }

  public void addToScene(UScene scene, UDriver driver, long selectedTexture) {
    nel3dJNI.UInstanceGroup_addToScene__SWIG_0(swigCPtr, this, UScene.getCPtr(scene), scene, UDriver.getCPtr(driver), driver, selectedTexture);
  }

  public void addToScene(UScene scene, UDriver driver) {
    nel3dJNI.UInstanceGroup_addToScene__SWIG_1(swigCPtr, this, UScene.getCPtr(scene), scene, UDriver.getCPtr(driver), driver);
  }

  public void addToScene(UScene scene) {
    nel3dJNI.UInstanceGroup_addToScene__SWIG_2(swigCPtr, this, UScene.getCPtr(scene), scene);
  }

  public void addToSceneAsync(UScene scene, UDriver driver, long selectedTexture) {
    nel3dJNI.UInstanceGroup_addToSceneAsync__SWIG_0(swigCPtr, this, UScene.getCPtr(scene), scene, UDriver.getCPtr(driver), driver, selectedTexture);
  }

  public void addToSceneAsync(UScene scene, UDriver driver) {
    nel3dJNI.UInstanceGroup_addToSceneAsync__SWIG_1(swigCPtr, this, UScene.getCPtr(scene), scene, UDriver.getCPtr(driver), driver);
  }

  public void addToSceneAsync(UScene scene) {
    nel3dJNI.UInstanceGroup_addToSceneAsync__SWIG_2(swigCPtr, this, UScene.getCPtr(scene), scene);
  }

  public void stopAddToSceneAsync() {
    nel3dJNI.UInstanceGroup_stopAddToSceneAsync(swigCPtr, this);
  }

  public UInstanceGroup.TState getAddToSceneState() {
    return UInstanceGroup.TState.swigToEnum(nel3dJNI.UInstanceGroup_getAddToSceneState(swigCPtr, this));
  }

  public void removeFromScene(UScene scene) {
    nel3dJNI.UInstanceGroup_removeFromScene(swigCPtr, this, UScene.getCPtr(scene), scene);
  }

  public static UInstanceGroup createInstanceGroup(String instanceGroup) {
    long cPtr = nel3dJNI.UInstanceGroup_createInstanceGroup(instanceGroup);
    return (cPtr == 0) ? null : new UInstanceGroup(cPtr, false);
  }

  public static void createInstanceGroupAsync(String instanceGroup, SWIGTYPE_p_p_NL3D__UInstanceGroup pIG) {
    nel3dJNI.UInstanceGroup_createInstanceGroupAsync(instanceGroup, SWIGTYPE_p_p_NL3D__UInstanceGroup.getCPtr(pIG));
  }

  public static void stopCreateInstanceGroupAsync(SWIGTYPE_p_p_NL3D__UInstanceGroup pIG) {
    nel3dJNI.UInstanceGroup_stopCreateInstanceGroupAsync(SWIGTYPE_p_p_NL3D__UInstanceGroup.getCPtr(pIG));
  }

  public long getNumInstance() {
    return nel3dJNI.UInstanceGroup_getNumInstance(swigCPtr, this);
  }

  public String getShapeName(long instanceNb) {
    return nel3dJNI.UInstanceGroup_getShapeName(swigCPtr, this, instanceNb);
  }

  public String getInstanceName(long instanceNb) {
    return nel3dJNI.UInstanceGroup_getInstanceName(swigCPtr, this, instanceNb);
  }

  public void getInstanceMatrix(long instanceNb, SWIGTYPE_p_NLMISC__CMatrix dest) {
    nel3dJNI.UInstanceGroup_getInstanceMatrix(swigCPtr, this, instanceNb, SWIGTYPE_p_NLMISC__CMatrix.getCPtr(dest));
  }

  public CVector getInstancePos(long instanceNb) {
    return new CVector(nel3dJNI.UInstanceGroup_getInstancePos(swigCPtr, this, instanceNb), false);
  }

  public SWIGTYPE_p_NLMISC__CQuat getInstanceRot(long instanceNb) {
    return new SWIGTYPE_p_NLMISC__CQuat(nel3dJNI.UInstanceGroup_getInstanceRot(swigCPtr, this, instanceNb), false);
  }

  public CVector getInstanceScale(long instanceNb) {
    return new CVector(nel3dJNI.UInstanceGroup_getInstanceScale(swigCPtr, this, instanceNb), false);
  }

  public UInstance getInstance(long instanceNb) {
    return new UInstance(nel3dJNI.UInstanceGroup_getInstance(swigCPtr, this, instanceNb), true);
  }

  public int getIndexByName(String name) {
    return nel3dJNI.UInstanceGroup_getIndexByName(swigCPtr, this, name);
  }

  public UInstance getByName(String name) {
    return new UInstance(nel3dJNI.UInstanceGroup_getByName(swigCPtr, this, name), true);
  }

  public void setBlendShapeFactor(String bsName, float rFactor) {
    nel3dJNI.UInstanceGroup_setBlendShapeFactor(swigCPtr, this, bsName, rFactor);
  }

  public void createRoot(UScene scene) {
    nel3dJNI.UInstanceGroup_createRoot(swigCPtr, this, UScene.getCPtr(scene), scene);
  }

  public void setClusterSystemForInstances(UInstanceGroup pClusterSystem) {
    nel3dJNI.UInstanceGroup_setClusterSystemForInstances(swigCPtr, this, UInstanceGroup.getCPtr(pClusterSystem), pClusterSystem);
  }

  public boolean linkToParentCluster(UInstanceGroup father) {
    return nel3dJNI.UInstanceGroup_linkToParentCluster(swigCPtr, this, UInstanceGroup.getCPtr(father), father);
  }

  public UInstanceGroup getParentCluster() {
    long cPtr = nel3dJNI.UInstanceGroup_getParentCluster(swigCPtr, this);
    return (cPtr == 0) ? null : new UInstanceGroup(cPtr, false);
  }

  public void getDynamicPortals(Vector_String names) {
    nel3dJNI.UInstanceGroup_getDynamicPortals(swigCPtr, this, Vector_String.getCPtr(names), names);
  }

  public void setDynamicPortal(SWIGTYPE_p_std__string name, boolean opened) {
    nel3dJNI.UInstanceGroup_setDynamicPortal(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(name), opened);
  }

  public boolean getDynamicPortal(SWIGTYPE_p_std__string name) {
    return nel3dJNI.UInstanceGroup_getDynamicPortal(swigCPtr, this, SWIGTYPE_p_std__string.getCPtr(name));
  }

  public void setPos(CVector pos) {
    nel3dJNI.UInstanceGroup_setPos(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public void setRotQuat(SWIGTYPE_p_NLMISC__CQuat q) {
    nel3dJNI.UInstanceGroup_setRotQuat(swigCPtr, this, SWIGTYPE_p_NLMISC__CQuat.getCPtr(q));
  }

  public CVector getPos() {
    return new CVector(nel3dJNI.UInstanceGroup_getPos(swigCPtr, this), true);
  }

  public SWIGTYPE_p_NLMISC__CQuat getRotQuat() {
    return new SWIGTYPE_p_NLMISC__CQuat(nel3dJNI.UInstanceGroup_getRotQuat(swigCPtr, this), true);
  }

  public void freezeHRC() {
    nel3dJNI.UInstanceGroup_freezeHRC(swigCPtr, this);
  }

  public void unfreezeHRC() {
    nel3dJNI.UInstanceGroup_unfreezeHRC(swigCPtr, this);
  }

  public boolean getStaticLightSetup(CRGBA sunAmbient, long retrieverIdentifier, int surfaceId, CVector localPos, SWIGTYPE_p_std__vectorT_NL3D__CPointLightInfluence_t pointLightList, SWIGTYPE_p_unsigned_char sunContribution, CRGBA localAmbient) {
    return nel3dJNI.UInstanceGroup_getStaticLightSetup(swigCPtr, this, CRGBA.getCPtr(sunAmbient), sunAmbient, retrieverIdentifier, surfaceId, CVector.getCPtr(localPos), localPos, SWIGTYPE_p_std__vectorT_NL3D__CPointLightInfluence_t.getCPtr(pointLightList), SWIGTYPE_p_unsigned_char.getCPtr(sunContribution), CRGBA.getCPtr(localAmbient), localAmbient);
  }

  public void setDistMax(long instance, float dist) {
    nel3dJNI.UInstanceGroup_setDistMax(swigCPtr, this, instance, dist);
  }

  public float getDistMax(long instance) {
    return nel3dJNI.UInstanceGroup_getDistMax(swigCPtr, this, instance);
  }

  public void setCoarseMeshDist(long instance, float dist) {
    nel3dJNI.UInstanceGroup_setCoarseMeshDist(swigCPtr, this, instance, dist);
  }

  public float getCoarseMeshDist(long instance) {
    return nel3dJNI.UInstanceGroup_getCoarseMeshDist(swigCPtr, this, instance);
  }

  public void displayDebugClusters(UDriver drv, UTextContext txtCtx) {
    nel3dJNI.UInstanceGroup_displayDebugClusters(swigCPtr, this, UDriver.getCPtr(drv), drv, UTextContext.getCPtr(txtCtx), txtCtx);
  }

  public boolean dontCastShadowForInterior(long instance) {
    return nel3dJNI.UInstanceGroup_dontCastShadowForInterior(swigCPtr, this, instance);
  }

  public boolean dontCastShadowForExterior(long instance) {
    return nel3dJNI.UInstanceGroup_dontCastShadowForExterior(swigCPtr, this, instance);
  }

  public final static class TState {
    public final static TState StateNotAdded = new TState("StateNotAdded", nel3dJNI.UInstanceGroup_StateNotAdded_get());
    public final static TState StateAdding = new TState("StateAdding");
    public final static TState StateAdded = new TState("StateAdded");
    public final static TState StateError = new TState("StateError");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TState swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TState.class + " with value " + swigValue);
    }

    private TState(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TState(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TState(String swigName, TState swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TState[] swigValues = { StateNotAdded, StateAdding, StateAdded, StateError };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
